//接收action的信息进行数据处理。

import { ADDNAME, ADDNAMELIST, QUEUEINFO, TRUCKLIST, POUNDINFO, ELECTINFO, BURNTINFO,ROLE,Id } from './action-type'
import { combineReducers } from 'redux'

//{自定义接收数据处理方法}
function addname (state='initRedux',action) {
    switch(action.type){
        case ADDNAME:
            return action.data
        default:
            return state
    }
}
//{自定义接收数据处理方法}--数组处理
function addnamelist(state = [], action) {
    switch (action.type) {
        case ADDNAMELIST:
            state.unshift(action.data)
            return state
        default:
            return state
    }
}

function addQueueInfoList(state = [], action) {
    switch (action.type) {
        case QUEUEINFO:
            state = action.data
            return state
        default:
            return state
    }
}

function addTrucklist(state = [], action) {
    switch (action.type) {
        case TRUCKLIST:
            state = action.data
            return state
        default:
            return state
    }
}

function addPoundInfolist(state = [], action) {
    switch (action.type) {
        case POUNDINFO:
            state = action.data
            return state
        default:
            return state
    }
}

function addElectInfolist(state = [], action) {
    switch (action.type) {
        case ELECTINFO:
            state = action.data
            return state
        default:
            return state
    }
}

function addBurntInfolist(state = [], action) {
    switch (action.type) {
        case BURNTINFO:
            state = action.data
            return state
        default:
            return state
    }
}

function addRole(state = [],action){
    switch (action.type) {
        case ROLE:
            state = action.data
            return state
        default:
            return state
    }
}

function addId(state = [],action){
    switch (action.type) {
        case Id:
            state = action.data
            return state
        default:
            return state
    }
}
export const finalReducer = combineReducers({
    addname, addnamelist, addQueueInfoList, addTrucklist, addPoundInfolist, addElectInfolist, addBurntInfolist,addRole,addId
})